Skip to content

Conversation

@rustyrussell
Copy link
Contributor

This is a new RPC, improving on sendonion, which takes the same path as an onion coming in an HTLC from a peer. This vastly simplifies handling cases like blinded paths which start at this peer, and self-pay: both are handled automatically.

In addition, the call simply blocks, rather than requiring another call to receive the results.

@rustyrussell rustyrussell added this to the v24.11 milestone Oct 18, 2024
@rustyrussell rustyrussell requested a review from cdecker as a code owner October 18, 2024 04:16
@rustyrussell
Copy link
Contributor Author

Trivial master rebase, and tests are now split properly (final fixup commit). If this is OK, I'll fold and apply.

@rustyrussell rustyrussell force-pushed the injectpaymentonion branch 2 times, most recently from fee3cf8 to 5727b79 Compare October 21, 2024 23:56
This makes it slightly more generic.

Signed-off-by: Rusty Russell <[email protected]>
…r_unknown_payment_details

This message is supposed to include the msat amount received.  But this is
obviously per-HTLC, and we hacked it to use the value for the first one.

And we add logging whenever we fail an HTLC set, since we removed logging
by not calling failmsg_incorrect_or_unknown() (which, now, no longer needs
to log).

Signed-off-by: Rusty Russell <[email protected]>
Make it a set of arbitrary data, so we can use it for local payments,
not just HTLCs.

Signed-off-by: Rusty Russell <[email protected]>
…tpaymentonion.

Rather than assuming the callbacks, make them function pointers.

Signed-off-by: Rusty Russell <[email protected]>
Put these in utils and make them a bit more powerful, so we can use
them elsewhere.

Signed-off-by: Rusty Russell <[email protected]>
Don't assume we have an outgoing HTLC at this level.

Note that previously we didn't save the failed onion unless it was
unparsable: we keep that both for space savings and because our
`waitsendpay` logic assumes that when it fetches from the db if
there's a failonion it was unparsable!

Signed-off-by: Rusty Russell <[email protected]>
This is like `sendonion` but unwraps the onion as the first hop,
avoiding nasty special cases for blinded paths which start with this
node, and also self-pay.

Tests split into multiple ones after Christian's review.

Changelog-Added: JSON-RPC: `injectpaymentonion` for initiating an HTLC like a peer would do.
Signed-off-by: Rusty Russell <[email protected]>
@rustyrussell rustyrussell merged commit 916a36a into ElementsProject:master Oct 27, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants